#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c;
    cin >> a >> b >> c;
 /*    long long x = min(a, c);
    long long yu = a + b + c - x - x;
    x = min(x, yu);
    cout << x << endl; */
    cout << min({a, c, (a + b + c) / 3}) << endl;
  }
  return 0; 
}